package com.test.practice.socket;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * Ip and port
 *
 * @Description: Ip and port
 * =======================
 * @Author: Jovi
 * =======================
 * @Date: Created in 2023-02-10
 * =======================
 * @Version: 1.1.2.0
 */
public class InetAddressDemo {

    public static void main(String[] args) throws Exception {
        InetAddress localHost = InetAddress.getLocalHost();

        System.out.println(localHost);
        System.out.println(localHost.getHostAddress());
        System.out.println(localHost.getHostName());
        System.out.println(localHost.getCanonicalHostName());



        InetAddress inetAddress1 = InetAddress.getByName("127.0.0.1");
        System.out.println(inetAddress1);
    }
}
